--罗技鼠标宏LUA语言,参考文档:G-series Lua API

Barbarian_Macro_LoopInterval = 10 --脚本循环间隔（毫秒）

EnablePrimaryMouseButtonEvents(true)  --开启响应鼠标事件

function OnEvent(event, arg, family)
	--if (event == "G_RELEASED" and arg == 4) then --4为罗技键盘G4键
	if (event == "MOUSE_BUTTON_RELEASED" and arg == 6 and IsKeyLockOn("scrolllock")) then --3为罗技鼠标中键，5为侧键前进，4为侧键返回
		dianyunshi()
	end

	if (event == "MOUSE_BUTTON_RELEASED" and arg == 6 and IsKeyLockOn("capslock")) then --3为罗技鼠标中键，5为侧键前进，4为侧键返回
		houniaoshushua()
	end

	if (event == "MOUSE_BUTTON_RELEASED" and arg == 5 and IsKeyLockOn("scrolllock")) then --3为罗技鼠标中键，5为侧键前进，4为侧键返回
		--xfz()
	end
end

---------------------------------------------------------------------------------------------------------
--法师

--上帝电陨速刷悬赏蓝门小秘境大秘境100、522电奥陨刷速大秘境110、不死鸟
--F2：站立攻击
--F7：强制移动

function dianyunshi()
	if (IsKeyLockOn("scrolllock")) then
		--左键技能
		PressKey("f2")
		Sleep(25)
		PressAndReleaseMouseButton(1)--点击左键
		Sleep(20)
		ReleaseKey("f2")
		Sleep(55)
		PressAndReleaseKey("2")
		Sleep(55)
		PressAndReleaseKey("3")
		Sleep(55)
		PressAndReleaseKey("4")
		Sleep(100)

		Times_Key_F7 = 0
		Times_Key_1 = 0
		Times_Key_2 = 0
		Times_Key_3 = 0
		Times_Key_4 = 0
		Times_Key_5 = 0
		Times_Key_6 = 0
	end

	--如果scrolllock键已按下则启动循环，否则退出循环
	while (IsKeyLockOn("scrolllock")) do
		Sleep(Barbarian_Macro_LoopInterval) --循环间隔

		Times_Key_F7 = Times_Key_F7 + 1
		Times_Key_1 = Times_Key_1 + 1
		Times_Key_2 = Times_Key_2 + 1
		Times_Key_3 = Times_Key_3 + 1
		Times_Key_4 = Times_Key_4 + 1
		Times_Key_5 = Times_Key_5 + 1
		Times_Key_6 = Times_Key_6 + 1

		--每N秒按下并释放F3键
		if ((Times_Key_F7*Barbarian_Macro_LoopInterval) >= 110) then
			if not (IsMouseButtonPressed(3)) then  --如果右键没有按下
				if (IsModifierPressed("lshift")) then --按住lshift键中断强制移动
					PressAndReleaseMouseButton(1)--点击左键
				else
					PressAndReleaseKey("f7")--点击F7键
				end
			end
			Times_Key_F7 = 0
		end

		--每N秒按下并释放1键
		if ((Times_Key_1*Barbarian_Macro_LoopInterval) >= 200) then
			--PressAndReleaseKey("1")
			Times_Key_1 = 0
		end

		--每N秒按下并释放2键
		if ((Times_Key_2*Barbarian_Macro_LoopInterval) >= 300) then
			PressAndReleaseKey("2")
			Times_Key_2 = 0
		end

		--每N秒按下并释放3键
		if ((Times_Key_3*Barbarian_Macro_LoopInterval) >= 500050) then
			PressAndReleaseKey("3")
			Times_Key_3 = 0
		end

		--每N秒按下并释放4键
		if ((Times_Key_4*Barbarian_Macro_LoopInterval) >= 500070) then
			PressAndReleaseKey("4")
			Times_Key_4 = 0
		end

		--每N秒按下并释放鼠标右键
		if ((Times_Key_6*Barbarian_Macro_LoopInterval) >= 2000) then
			--PressAndReleaseMouseButton(3)--点击右键
			Times_Key_6 = 0
		end

		--每N秒按下并释放鼠标左键
		if ((Times_Key_5*Barbarian_Macro_LoopInterval) >= 500000) then
			PressKey("f2")
			Sleep(20)
			PressAndReleaseMouseButton(1)--点击左键
			Sleep(25)
			ReleaseKey("f2")
			Times_Key_5 = 0
		end
	end

	--循环结束，释放鼠标
	ReleaseKey("f2")--释放F2键
	ReleaseKey("f7")--释放F3键
end


--火鸟速刷
--F2：站立攻击
--F7：强制移动

function houniaoshushua()
	if (IsKeyLockOn("capslock")) then
		--左键技能
		PressKey("f2")
		Sleep(25)
		PressAndReleaseMouseButton(1)--点击左键
		Sleep(20)
		ReleaseKey("f2")
		Sleep(55)
		PressAndReleaseKey("3")
		Sleep(55)
		PressAndReleaseKey("4")
		Sleep(100)

		PressMouseButton(3)--按下右键

		Times_Key_1 = 0
		Times_Key_2 = 0
		Times_Key_3 = 0
		Times_Key_4 = 0
		Times_Key_5 = 0
		Times_Key_6 = 0
	end

	--如果scrolllock键已按下则启动循环，否则退出循环
	while (IsKeyLockOn("capslock")) do
		Sleep(Barbarian_Macro_LoopInterval) --循环间隔

		Times_Key_1 = Times_Key_1 + 1
		Times_Key_2 = Times_Key_2 + 1
		Times_Key_3 = Times_Key_3 + 1
		Times_Key_4 = Times_Key_4 + 1
		Times_Key_5 = Times_Key_5 + 1
		Times_Key_6 = Times_Key_6 + 1

		--每N秒按下并释放1键
		if ((Times_Key_1*Barbarian_Macro_LoopInterval) >= 200) then
			--PressAndReleaseKey("1")
			Times_Key_1 = 0
		end

		--每N秒按下并释放2键
		if ((Times_Key_2*Barbarian_Macro_LoopInterval) >= 200) then
			PressAndReleaseKey("2")
			Times_Key_2 = 0
		end

		--每N秒按下并释放3键
		if ((Times_Key_3*Barbarian_Macro_LoopInterval) >= 500050) then
			PressAndReleaseKey("3")
			Times_Key_3 = 0
		end

		--每N秒按下并释放4键
		if ((Times_Key_4*Barbarian_Macro_LoopInterval) >= 500070) then
			PressAndReleaseKey("4")
			Times_Key_4 = 0
		end

		--每N秒按下并释放鼠标右键
		if ((Times_Key_6*Barbarian_Macro_LoopInterval) >= 2000) then
			--PressAndReleaseMouseButton(3)--点击右键
			Times_Key_6 = 0
		end

		--每N秒按下并释放鼠标左键
		if ((Times_Key_5*Barbarian_Macro_LoopInterval) >= 500000) then
			PressKey("f2")
			Sleep(20)
			PressAndReleaseMouseButton(1)--点击左键
			Sleep(25)
			ReleaseKey("f2")
			Times_Key_5 = 0
		end

		if (IsModifierPressed("lshift")) then --按住lshift键中断技能
			ReleaseMouseButton(3)
			Sleep(10)
			ReleaseKey("f2")
			Sleep(20)
			--PressAndReleaseMouseButton(1)--按下左键
		else
			if not (IsMouseButtonPressed(3)) then  --如果右键没有按下
				ReleaseMouseButton(3)--释放鼠标右键
				Sleep(10)
				PressMouseButton(3)--按下鼠标右键
			end
		end
	end

	--循环结束，释放鼠标
	ReleaseMouseButton(3)--释放鼠标右键
	ReleaseKey("f2")--释放F2键
end
---------------------------------------------------------------------------------------------------------
--猎魔人

--恐惧冰吞速刷悬赏小秘境大秘境
--F2：站立攻击
--F3：强制移动

function kongjubingtun()
	if (IsKeyLockOn("capslock")) then
		--左键技能
		PressKey("f2")
		Sleep(60)
		PressAndReleaseMouseButton(1)
		Sleep(20)
		ReleaseKey("f2")
		Sleep(100)

		PressMouseButton(3)--按下右键

		Times_Key_1 = 0
		Times_Key_2 = 0
		Times_Key_3 = 0
		Times_Key_4 = 0
		Times_Key_5 = 0
		Times_Key_6 = 0
	end

	--如果scrolllock键已按下则启动循环，否则退出循环
	while (IsKeyLockOn("capslock")) do
		Sleep(Barbarian_Macro_LoopInterval) --循环间隔

		Times_Key_1 = Times_Key_1 + 1
		Times_Key_2 = Times_Key_2 + 1
		Times_Key_3 = Times_Key_3 + 1
		Times_Key_4 = Times_Key_4 + 1
		Times_Key_5 = Times_Key_5 + 1
		Times_Key_6 = Times_Key_6 + 1

		--每N秒按下并释放1键
		if ((Times_Key_1*Barbarian_Macro_LoopInterval) >= 200) then
			PressAndReleaseKey("f5")--点击F5键
			Times_Key_1 = 0
		end

		--每N秒按下并释放2键
		if ((Times_Key_2*Barbarian_Macro_LoopInterval) >= 300) then
			PressAndReleaseKey("f6")--点击F6键
			Times_Key_2 = 0
		end

		--每N秒按下并释放3键
		if ((Times_Key_3*Barbarian_Macro_LoopInterval) >= 330) then
			PressAndReleaseKey("f7")--点击F7键
			Times_Key_3 = 0
		end

		--每N秒按下并释放4键
		if ((Times_Key_4*Barbarian_Macro_LoopInterval) >= 510) then
			PressAndReleaseKey("f8")--点击F8键
			Times_Key_4 = 0
		end

		--每N秒按下并释放鼠标右键
		if ((Times_Key_6*Barbarian_Macro_LoopInterval) >= 2000) then
			--PressAndReleaseMouseButton(3)--点击右键
			Times_Key_6 = 0
		end

		--每N秒按下并释放鼠标左键
		if ((Times_Key_5*Barbarian_Macro_LoopInterval) >= 3330) then
			PressKey("f2")
			Sleep(100)
			PressAndReleaseMouseButton(1)--点击左键
			Sleep(100)
			ReleaseKey("f2")
			Times_Key_5 = 0
		end

		if (IsModifierPressed("shift")) then --按住lshift键中断技能
			ReleaseMouseButton(3)
			Sleep(10)
			ReleaseKey("f2")
			Sleep(20)
			PressAndReleaseMouseButton(1)
		else
			if not (IsMouseButtonPressed(3)) then  --如果右键没有按下
				ReleaseMouseButton(3)--释放鼠标右键
				Sleep(10)
				PressMouseButton(3)--按下鼠标右键
			end
		end
	end

	--循环结束，释放鼠标
	ReleaseMouseButton(3)--释放鼠标右键
	ReleaseKey("f2")--释放F2键
end

--掠夺集束
function ldjs()
	if (IsKeyLockOn("capslock")) then
		--PressMouseButton(3)--扫射在右键

		Times_Key_1 = 0
		Times_Key_2 = 0
		Times_Key_3 = 0
		Times_Key_4 = 0
		Times_Key_5 = 0
		Times_Key_6 = 0
	end

	--如果scrolllock键已按下则启动循环，否则退出循环
	while (IsKeyLockOn("capslock")) do
		Sleep(Barbarian_Macro_LoopInterval) --循环间隔

		Times_Key_1 = Times_Key_1 + 1
		Times_Key_2 = Times_Key_2 + 1
		Times_Key_3 = Times_Key_3 + 1
		Times_Key_4 = Times_Key_4 + 1
		Times_Key_5 = Times_Key_5 + 1
		Times_Key_6 = Times_Key_6 + 1

		--每N秒按下并释放1键
		if IsMouseButtonPressed(3) then
			if ((Times_Key_1*Barbarian_Macro_LoopInterval) >= 220) then
				PressAndReleaseKey(0x3F)--按下F5键
				Times_Key_1 = 0
			end
		else
			if ((Times_Key_1*Barbarian_Macro_LoopInterval) >= 100) then
				PressAndReleaseKey(0x3D)--点击F3键强制移动
				Times_Key_1 = 0
			end
		end

		--每N秒按下并释放2键
		if ((Times_Key_2*Barbarian_Macro_LoopInterval) >= 410) then
			PressAndReleaseKey(0x40)--按下F6键
			Times_Key_2 = 0
		end

		--每N秒按下并释放3键
		if ((Times_Key_3*Barbarian_Macro_LoopInterval) >= 3200) then
			PressAndReleaseKey(0x41)--按下F7键
			Times_Key_3 = 0
		end

		--每N秒按下并释放4键
		if ((Times_Key_4*Barbarian_Macro_LoopInterval) >= 110) then
			--PressAndReleaseKey(0x42)--按下F8键
			Times_Key_4 = 0
		end

		--每N秒按下并释放鼠标右键
		if ((Times_Key_6*Barbarian_Macro_LoopInterval) >= 2000) then
			--PressAndReleaseMouseButton(3)
			Times_Key_6 = 0
		end

		--每N秒按下并释放鼠标左键
		if ((Times_Key_5*Barbarian_Macro_LoopInterval) >= 2000) then
			PressKey(0x3C)
		end
		if ((Times_Key_5*Barbarian_Macro_LoopInterval) >= 2100) then
			PressAndReleaseMouseButton(1)
			Sleep(100)
			ReleaseKey(0x3C)
			Times_Key_5 = 0
		end

		if (IsModifierPressed("shift")) then --按住lshift键中断技能
			PressAndReleaseMouseButton(1)
			Sleep(100)
		end
	end

	--循环结束，释放鼠标
	ReleaseKey(0x3C)
end

--多重回响
function hx()
	if (IsKeyLockOn("capslock")) then
		--PressMouseButton(3)--扫射在右键

		Times_Key_1 = 0
		Times_Key_2 = 0
		Times_Key_3 = 0
		Times_Key_4 = 0
		Times_Key_5 = 0
		Times_Key_6 = 0
	end

	--如果scrolllock键已按下则启动循环，否则退出循环
	while (IsKeyLockOn("capslock")) do
		Sleep(Barbarian_Macro_LoopInterval) --循环间隔

		Times_Key_1 = Times_Key_1 + 1
		Times_Key_2 = Times_Key_2 + 1
		Times_Key_3 = Times_Key_3 + 1
		Times_Key_4 = Times_Key_4 + 1
		Times_Key_5 = Times_Key_5 + 1
		Times_Key_6 = Times_Key_6 + 1

		--每N秒按下并释放1键
		if IsMouseButtonPressed(3) then
			if ((Times_Key_1*Barbarian_Macro_LoopInterval) >= 220) then
				PressAndReleaseKey(0x3F)--按下F5键
				Times_Key_1 = 0
			end
		else
			if ((Times_Key_1*Barbarian_Macro_LoopInterval) >= 100) then
				PressAndReleaseKey(0x3D)--点击F3键强制移动
				Times_Key_1 = 0
			end
		end

		--每N秒按下并释放2键
		if ((Times_Key_2*Barbarian_Macro_LoopInterval) >= 410) then
			PressAndReleaseKey(0x40)--按下F6键
			Times_Key_2 = 0
		end

		--每N秒按下并释放3键
		if ((Times_Key_3*Barbarian_Macro_LoopInterval) >= 3200) then
			PressAndReleaseKey(0x41)--按下F7键
			Times_Key_3 = 0
		end

		--每N秒按下并释放4键
		if ((Times_Key_4*Barbarian_Macro_LoopInterval) >= 110) then
			PressAndReleaseKey(0x42)--按下F8键
			Times_Key_4 = 0
		end

		--每N秒按下并释放鼠标右键
		if ((Times_Key_6*Barbarian_Macro_LoopInterval) >= 2000) then
			--PressAndReleaseMouseButton(3)
			Times_Key_6 = 0
		end

		--每N秒按下并释放鼠标左键
		if ((Times_Key_5*Barbarian_Macro_LoopInterval) >= 2000) then
			PressKey(0x3C)
		end
		if ((Times_Key_5*Barbarian_Macro_LoopInterval) >= 2100) then
			PressAndReleaseMouseButton(1)
			Sleep(100)
			ReleaseKey(0x3C)
			Times_Key_5 = 0
		end

		if (IsModifierPressed("shift")) then --按住lshift键中断技能
			PressAndReleaseMouseButton(1)
			Sleep(100)
		end
	end

	--循环结束，释放鼠标
	ReleaseKey(0x3C)
end

---------------------------------------------------------------------------------------------------------
--5+3水人
function ynsr()
	if (IsKeyLockOn("scrolllock")) then
		F2 = 0
		Times_Key_1 = 0
		Times_Key_2 = 0
		Times_Key_3 = 0
		Times_Key_4 = 0
		Times_Key_5 = 0
	end

	while (IsKeyLockOn("scrolllock")) do
		Sleep(Barbarian_Macro_LoopInterval) --循环间隔--PressKey(0x3D)--按住F3
		Times_Key_1 = Times_Key_1 + 1
		Times_Key_2 = Times_Key_2 + 1
		Times_Key_3 = Times_Key_3 + 1
		Times_Key_4 = Times_Key_4 + 1
		Times_Key_5 = Times_Key_5 + 1
		if IsMouseButtonPressed(3) then
			PressKey(0x3C)--按住F2键
			if F2 == 0 then
				F2 = 1
				PressAndReleaseKey(0x40)--按下F6键
				Sleep(50)
			end
			if Times_Key_5 > 11 then
				Times_Key_1 = 0
				Times_Key_2 = 0
				Times_Key_3 = 0
				Times_Key_4 = 0
				Times_Key_5 = 0
			end
			if ((Times_Key_1*Barbarian_Macro_LoopInterval) == 3800) then
				PressAndReleaseKey(0x3F)--按下F5键
				Times_Key_1 = 0
			end
			if ((Times_Key_2*Barbarian_Macro_LoopInterval) == 2000) then
				PressAndReleaseKey(0x40)--按下F6键
				Times_Key_2 = 0
			end
			if ((Times_Key_3*Barbarian_Macro_LoopInterval) == 100) then
				PressAndReleaseKey(0x41)--按下F7键
				Times_Key_3 = 0
			end
			if ((Times_Key_4*Barbarian_Macro_LoopInterval) == 2000) then
				PressAndReleaseKey(0x42)--按下F8键
				Times_Key_4 = 0
			end
			if ((Times_Key_5*Barbarian_Macro_LoopInterval) == 110) then
				PressAndReleaseMouseButton(1)
				Times_Key_5 = 0
			end
		else
			if not (IsMouseButtonPressed(3)) and F2 == 1 then
				ReleaseKey(0x3C)--释放F2键
				F2 = 0
			end
			if IsModifierPressed("shift") then
				PressAndReleaseMouseButton(1)
				Sleep(100)
			else
				if ((Times_Key_3*Barbarian_Macro_LoopInterval) >= 100) then
					PressAndReleaseKey(0x3D)--点击F3键强制移动
					--PressAndReleaseMouseButton(1)
					PressAndReleaseKey(0x41)--按下F7键
					Times_Key_3 = 0
				end
				if ((Times_Key_4*Barbarian_Macro_LoopInterval) >= 320) then
					PressAndReleaseKey(0x42)--按下F8键
					Times_Key_4 = 0
				end
			end
		end
	end
	ReleaseKey(0x3C)--释放F2键
end

--尹杖火人
function ynhr()
	if (IsKeyLockOn("scrolllock")) then
		F2 = 0
		Times_Key = 0
		Times_Key_1 = 0
		Times_Key_2 = 0
		Times_Key_3 = 0
		Times_Key_4 = 0
		Times_Key_5 = 0
	end

	while (IsKeyLockOn("scrolllock")) do
		Sleep(Barbarian_Macro_LoopInterval) --循环间隔--PressKey(0x3D)--按住F3
		Times_Key_1 = Times_Key_1 + 1
		Times_Key_2 = Times_Key_2 + 1
		Times_Key_3 = Times_Key_3 + 1
		Times_Key_4 = Times_Key_4 + 1
		Times_Key_5 = Times_Key_5 + 1
		if IsMouseButtonPressed(3) then
			Times_Key = Times_Key + 1
			PressKey(0x3C)
			if F2 == 0 then
				F2 = 1
			end
			if Times_Key_5 > 30 then
				Times_Key_1 = 0
				Times_Key_2 = 0
				Times_Key_3 = 0
				Times_Key_4 = 0
				Times_Key_5 = 0
			end
			if ((Times_Key_1*Barbarian_Macro_LoopInterval) == 3600) then
				PressAndReleaseKey(0x3F)--按下F5键
				Times_Key_1 = 0
			end
			if ((Times_Key_2*Barbarian_Macro_LoopInterval) == 600) then
				PressAndReleaseKey(0x40)--按下F6键
				Times_Key_2 = 0
			end
			if ((Times_Key_3*Barbarian_Macro_LoopInterval) == 500) then
				PressAndReleaseKey(0x41)--按下F7键
				Times_Key_3 = 0
			end
			if ((Times_Key_4*Barbarian_Macro_LoopInterval) >= 300) then
				PressAndReleaseKey(0x42)--按下F8键
				Times_Key_4 = 0
			end
			if ((Times_Key_5*Barbarian_Macro_LoopInterval) == 300 and Times_Key >= 100) then
				PressAndReleaseMouseButton(1)
				Times_Key_5 = 0
			end
		else
			if not (IsMouseButtonPressed(3)) and F2 == 1 then
				ReleaseKey(0x3C)
				F2 = 0
				Times_Key = 0
			end
			if IsModifierPressed("shift") then
				PressAndReleaseMouseButton(1)
				Sleep(100)
			else
				if ((Times_Key_3*Barbarian_Macro_LoopInterval) >= 100) then
					PressAndReleaseKey(0x3D)--点击F3键强制移动
					PressAndReleaseKey(0x41)--按下F7键
					Times_Key_3 = 0
				end
			end
		end
	end
	ReleaseKey(0x3C)--放开F2键
	ReleaseMouseButton(3)
end

--神龙火人
function slhr()
	if IsKeyLockOn("capslock") then
		F2 = 0
		Times_Key = 0
		Times_Key_a = 0
		Times_Key_F3 = 0
	end

	while IsKeyLockOn("capslock") do
		Sleep(Barbarian_Macro_LoopInterval) --循环间隔--PressKey(0x3D)--按住F3
		if IsMouseButtonPressed(3) then
			Times_Key = Times_Key + 1
			PressKey(0x3C)
			if F2 == 0 then
				F2 = 1
			end

			if ((Times_Key*Barbarian_Macro_LoopInterval) == 200) then
				PressAndReleaseKey(0x40)--按下F6键
			end
			if ((Times_Key*Barbarian_Macro_LoopInterval) == 330) then
				PressAndReleaseMouseButton(1)
			end
			if ((Times_Key*Barbarian_Macro_LoopInterval) == 2500) then
				--PressAndReleaseKey(0x3F)--按下F5键
			end
			if ((Times_Key*Barbarian_Macro_LoopInterval) == 3000) then
				PressAndReleaseKey(0x42)--按下F8键
			end
			if ((Times_Key*Barbarian_Macro_LoopInterval) == 3200) then
				--PressAndReleaseKey(0x40)--按下F6键
			end
		else
			if not (IsMouseButtonPressed(3)) and F2 == 1 then
				Times_Key_a = Times_Key_a + 1
				if ((Times_Key_a*Barbarian_Macro_LoopInterval) == 10) then
					PressAndReleaseKey(0x40)--按下F6键
				end
				if ((Times_Key_a*Barbarian_Macro_LoopInterval) == 130) then
					PressAndReleaseKey(0x41)--按下F7键
				end
				if ((Times_Key_a*Barbarian_Macro_LoopInterval) == 350) then
					PressAndReleaseKey(0x40)--按下F6键
				end
				if ((Times_Key_a*Barbarian_Macro_LoopInterval) == 700) then
					ReleaseKey(0x3C)
					F2 = 0
				end
			else
				if Times_Key > 0 then
					Times_Key = 0
					Times_Key_a = 0
					F2 = 0
					ReleaseKey(0x3C)
				end
				Times_Key_F3 = Times_Key_F3 + 1
				if ((Times_Key_F3*Barbarian_Macro_LoopInterval) >= 100) then
					PressAndReleaseKey(0x3D)--点击F3键强制移动
					Times_Key_F3 = 0
				end
			end
		end
	end
end

--正义风雷冲
function zyflc()
	if (IsKeyLockOn("scrolllock")) then
		--按下并释放按键
		PressAndReleaseKey(0x3f)--按下F6键
		PressMouseButton(3)--引导技能在右键

		Times_Key_1 = 0
		Times_Key_2 = 0
		Times_Key_3 = 0
		Times_Key_4 = 0
		Times_Key_5 = 0
		Times_Key_6 = 0
	end

	--如果scrolllock键已按下则启动循环，否则退出循环
	while (IsKeyLockOn("scrolllock")) do
		Sleep(Barbarian_Macro_LoopInterval) --循环间隔

		Times_Key_1 = Times_Key_1 + 1
		Times_Key_2 = Times_Key_2 + 1
		Times_Key_3 = Times_Key_3 + 1
		Times_Key_4 = Times_Key_4 + 1
		Times_Key_5 = Times_Key_5 + 1
		Times_Key_6 = Times_Key_6 + 1

		--每N秒按下并释放1键
		if ((Times_Key_1*Barbarian_Macro_LoopInterval) >= 5800) then
			PressAndReleaseKey(0x3F)--按下F5键
			Times_Key_1 = 0
		end

		--每N秒按下并释放2键
		if ((Times_Key_2*Barbarian_Macro_LoopInterval) >= 420) then
			PressAndReleaseKey(0x40)--按下F6键
			Times_Key_2 = 0
		end

		--每N秒按下并释放3键
		if ((Times_Key_3*Barbarian_Macro_LoopInterval) >= 330) then
			PressAndReleaseKey(0x41)--按下F7键
			Times_Key_3 = 0
		end

		--每N秒按下并释放4键
		if ((Times_Key_4*Barbarian_Macro_LoopInterval) >= 510) then
			--PressAndReleaseKey(0x42)--按下F8键
			Times_Key_4 = 0
		end

		--每N秒按下并释放鼠标右键
		if ((Times_Key_6*Barbarian_Macro_LoopInterval) >= 2000) then
			--PressAndReleaseMouseButton(3)
			Times_Key_6 = 0
		end

		--每N秒按下并释放鼠标左键
		if ((Times_Key_5*Barbarian_Macro_LoopInterval) >= 100) then
			--PressKey(0x3C)
			--PressAndReleaseMouseButton(1)
			--ReleaseKey(0x3C)
			--Times_Key_5 = 0
		end

		if (IsModifierPressed("shift")) then --按住lshift键中断技能
			ReleaseMouseButton(3)
			if ((Times_Key_5*Barbarian_Macro_LoopInterval) >= 100) then
				--PressKey(0x3C)
				PressAndReleaseMouseButton(1)
				--ReleaseKey(0x3C)
				Times_Key_5 = 0
			end
		else
			if not (IsMouseButtonPressed(3)) then
				ReleaseMouseButton(3)--释放鼠标右键
				PressMouseButton(3)--按下鼠标右键
			else
				if (IsModifierPressed("alt")) then --按住lalt键开门或吃祭坛
					--ReleaseKey(0x3C)
				else
					--PressKey(0x3C)
				end
			end
		end
	end

	--循环结束，释放鼠标
	ReleaseMouseButton(3)--释放鼠标右键
end

---------------------------------------------------------------------------------------------------------
--旋风斩
function xfz()
	if (IsKeyLockOn("scrolllock")) then
		--按下并释放按键
		PressAndReleaseKey("4", "2")
		--按下并释放鼠标右键
		--PressAndReleaseMouseButton(3)
		Sleep(10)
		-- 0 +鼠标左键（启动左键旋风斩）
		--PressKey(0x3C)
		--PressMouseButton(1)
		PressMouseButton(3)--旋风斩在右键
		Times_Key_1 = 0
		Times_Key_2 = 0
		Times_Key_3 = 0
		Times_Key_4 = 0
		--Times_Key_6 = 0
	end

	--如果scrolllock键已按下则启动循环，否则退出循环
	while (IsKeyLockOn("scrolllock")) do
		Sleep(Barbarian_Macro_LoopInterval) --循环间隔

		Times_Key_1 = Times_Key_1 + 1
		Times_Key_2 = Times_Key_2 + 1
		Times_Key_3 = Times_Key_3 + 1
		Times_Key_4 = Times_Key_4 + 1
		--Times_Key_6 = Times_Key_6 + 1

		--每秒按下并释放1键
		if ((Times_Key_1*Barbarian_Macro_LoopInterval) == 3900) then
			PressAndReleaseKey(0x3F)--按下F5键
			Times_Key_1 = 0
		end

		--每秒按下并释放2键
		if ((Times_Key_2*Barbarian_Macro_LoopInterval) == 2000) then
			PressAndReleaseKey(0x40)--按下F6键
			Times_Key_2 = 0
		end

		--每秒按下并释放3键
		if ((Times_Key_3*Barbarian_Macro_LoopInterval) == 330) then
			PressAndReleaseKey(0x41)--按下F7键
			Times_Key_3 = 0
		end

		--每55秒按下并释放4键
		if ((Times_Key_4*Barbarian_Macro_LoopInterval) == 55000) then
			PressAndReleaseKey(0x42)--按下F8键
			Times_Key_4 = 0
		end

		--每N秒按下并释放鼠标右键
		--if ((Times_Key_6*Barbarian_Macro_LoopInterval) == 100000) then
		--	PressAndReleaseMouseButton(3)
		--	Times_Key_6 = 0
		--end

		if (IsModifierPressed("shift")) then --按住lshift键中断技能
			ReleaseMouseButton(3)
			PressAndReleaseMouseButton(1)
			Sleep(100)
		else
			if not (IsMouseButtonPressed(3)) then
				ReleaseMouseButton(3)
				PressMouseButton(3)
			else
				if (IsModifierPressed("alt")) then --按住lalt键开门或吃祭坛
  					--ReleaseKey(0x3C)
				else
					--PressKey(0x3C)
				end
			end
		end
	end

	--循环结束，释放鼠标左键
	ReleaseMouseButton(3)
	--ReleaseKey(0x3C)--释放F2键
end
---------------------------------------------------------------------------------------------------------
--勇气天拳
function yqtq()
	if (IsKeyLockOn("scrolllock")) then
		Times_Key_1 = 0
		Times_Key_2 = 0
		Times_Key_3 = 0
		Times_Key_4 = 0
		Times_Key_5 = 0

		PressAndReleaseKey(0x42)--按下F8键
	end

	while (IsKeyLockOn("scrolllock")) do
		Sleep(Barbarian_Macro_LoopInterval) --循环间隔--PressKey(0x3D)--按住F3
		Times_Key_1 = Times_Key_1 + 1
		Times_Key_2 = Times_Key_2 + 1
		Times_Key_3 = Times_Key_3 + 1
		Times_Key_4 = Times_Key_4 + 1
		Times_Key_5 = Times_Key_5 + 1
		if IsMouseButtonPressed(3) then
			PressKey(0x3C)
			if Times_Key_1 >35  then
				Times_Key_1 = 0
				Times_Key_2 = 0
				Times_Key_5 = 0
				Times_Key_4 = 0
			end
			if ((Times_Key_1*Barbarian_Macro_LoopInterval) == 350) then
				PressAndReleaseKey(0x3F)--按下F5键
				Times_Key_1 = 0
			end
			if ((Times_Key_2*Barbarian_Macro_LoopInterval) == 300) then
				PressAndReleaseKey(0x40)--按下F6键
				Times_Key_2 = 0
			end
			if ((Times_Key_5*Barbarian_Macro_LoopInterval) == 500) then
				--PressKey(0x3C)
				PressAndReleaseMouseButton(1)
				Times_Key_5 = 0
			end
			if ((Times_Key_4*Barbarian_Macro_LoopInterval) == 650) then
				PressAndReleaseKey(0x42)--按下F8键
				Times_Key_4 = 0
			end
		else
			if not (IsMouseButtonPressed(3)) then
				ReleaseKey(0x3C)
			end
			if IsModifierPressed("shift") then
				PressAndReleaseMouseButton(1)
			else
				PressAndReleaseKey(0x3D)--点击F3键强制移动
				if ((Times_Key_4*Barbarian_Macro_LoopInterval) >= 350) then
					PressAndReleaseKey(0x42)--按下F8键
					Times_Key_4 = 0
				end
				if ((Times_Key_3*Barbarian_Macro_LoopInterval) >= 500) then
					PressAndReleaseKey(0x41)--按下F7键
					Times_Key_3 = 0
				end
			end
		end
	end
end

--勇气天拳小秘
function yqtqxm()
	if (IsKeyLockOn("scrolllock")) then
		Times_Key_1 = 0
		Times_Key_2 = 0
		Times_Key_3 = 0
		Times_Key_4 = 0
		Times_Key_5 = 0

		PressAndReleaseKey(0x42)--按下F8键
	end

	while (IsKeyLockOn("scrolllock")) do
		Sleep(Barbarian_Macro_LoopInterval) --循环间隔--PressKey(0x3D)--按住F3
		Times_Key_1 = Times_Key_1 + 1
		Times_Key_2 = Times_Key_2 + 1
		Times_Key_3 = Times_Key_3 + 1
		Times_Key_4 = Times_Key_4 + 1
		Times_Key_5 = Times_Key_5 + 1
		if IsMouseButtonPressed(3) then
			PressKey(0x3C)
			if Times_Key_1 > 35 then
				Times_Key_1 = 0
				Times_Key_2 = 0
				Times_Key_5 = 0
				Times_Key_3 = 0
				Times_Key_4 = 0
			end
			if ((Times_Key_1*Barbarian_Macro_LoopInterval) == 350) then
				PressAndReleaseKey(0x3F)--按下F5键
				Times_Key_1 = 0
			end
			if ((Times_Key_2*Barbarian_Macro_LoopInterval) == 300) then
				PressAndReleaseKey(0x40)--按下F6键
				Times_Key_2 = 0
			end
			if ((Times_Key_5*Barbarian_Macro_LoopInterval) == 500) then
				--PressKey(0x3C)
				PressAndReleaseMouseButton(1)
				Times_Key_5 = 0
			end
			if ((Times_Key_3*Barbarian_Macro_LoopInterval) == 1000) then
				PressAndReleaseKey(0x41)--按下F7键
				Times_Key_3 = 0
			end
			if ((Times_Key_4*Barbarian_Macro_LoopInterval) == 650) then
				PressAndReleaseKey(0x42)--按下F8键
				Times_Key_4 = 0
			end
		else
			if not (IsMouseButtonPressed(3)) then
				ReleaseKey(0x3C)
			end
			if IsModifierPressed("shift") then
				PressAndReleaseMouseButton(1)
			else
				PressAndReleaseKey(0x3D)--点击F3键强制移动
				if ((Times_Key_4*Barbarian_Macro_LoopInterval) >= 500) then
					PressAndReleaseKey(0x42)--按下F8键
					Times_Key_4 = 0
				end
			end
		end
	end
end

--散炮
function sp()
	if (IsKeyLockOn("scrolllock")) then
		Times_Key_1 = 0
		Times_Key_2 = 0
		Times_Key_3 = 0
		Times_Key_4 = 0
		--Times_Key_6 = 0
	end

	while (IsKeyLockOn("scrolllock")) do
		Sleep(Barbarian_Macro_LoopInterval) --循环间隔--PressKey(0x3D)--按住F3
		Times_Key_1 = Times_Key_1 + 1
		Times_Key_2 = Times_Key_2 + 1
		Times_Key_3 = Times_Key_3 + 1
		Times_Key_4 = Times_Key_4 + 1
		Times_Key_6 = Times_Key_6 + 1
		if (IsModifierPressed("shift")) then
			if Times_Key_6 > 7 then
				Times_Key_1 = 0
				Times_Key_2 = 0
				Times_Key_3 = 0
				Times_Key_4 = 0
				Times_Key_6 = 0
			end
			if ((Times_Key_1*Barbarian_Macro_LoopInterval) == 60) then
				PressAndReleaseKey(0x3F)--按下F5键
				Times_Key_1 = 0
			end
			if ((Times_Key_2*Barbarian_Macro_LoopInterval) == 50) then
				PressAndReleaseKey(0x40)--按下F6键
				Times_Key_2 = 0
			end
			if ((Times_Key_3*Barbarian_Macro_LoopInterval) == 40) then
				PressAndReleaseKey(0x41)--按下F7键
				Times_Key_3 = 0
			end
			if ((Times_Key_4*Barbarian_Macro_LoopInterval) == 30) then
				PressAndReleaseKey(0x42)--按下F8键
				Times_Key_4 = 0
			end
			if ((Times_Key_6*Barbarian_Macro_LoopInterval) == 70) then
				PressAndReleaseMouseButton(3)--按下右键
				Times_Key_6 = 0
			end
		else
			PressAndReleaseMouseButton(1)
			--PressAndReleaseKey(0x3D)--点击F3键强制移动
			if ((Times_Key_4*Barbarian_Macro_LoopInterval) >= 30) then
				PressAndReleaseKey(0x42)--按下F8键
				Times_Key_4 = 0
			end
		end
	end
end

--天譴
function tq()
	if (IsKeyLockOn("scrolllock")) then
		--按下并释放按键
		PressAndReleaseKey(0x42)--按下F8键
		Sleep(10)

		Times_Key_1 = 0
		Times_Key_2 = 0
		Times_Key_3 = 0
		Times_Key_4 = 0
		Times_Key_5 = 0
		Times_Key_6 = 0
	end

	--如果scrolllock键已按下启动循环，否则退出循环--如果scrolllock键已按下并且numlock已按下则启动循环，否则退出循环
	while (IsKeyLockOn("scrolllock")) do
		Sleep(Barbarian_Macro_LoopInterval) --循环间隔
		--PressAndReleaseMouseButton(1)
		--PressAndReleaseKey(0x3D)

		Times_Key_1 = Times_Key_1 + 1
		Times_Key_2 = Times_Key_2 + 1
		Times_Key_3 = Times_Key_3 + 1
		Times_Key_4 = Times_Key_4 + 1
		Times_Key_5 = Times_Key_5 + 1
		Times_Key_6 = Times_Key_6 + 1

		--每1秒按下并释放1键
		if ((Times_Key_1*Barbarian_Macro_LoopInterval) == 300) then
			PressAndReleaseKey(0x3F)--按下F5键
			Times_Key_1 = 0
		end
		--每N秒按下并释放2键
		if ((Times_Key_2*Barbarian_Macro_LoopInterval) == 330) then
			PressAndReleaseKey(0x40)--按下F6键
			Times_Key_2 = 0
		end
		--每N秒按下并释放3键
		if ((Times_Key_3*Barbarian_Macro_LoopInterval) == 360) then
			PressAndReleaseKey(0x41)--按下F7键
			Times_Key_3 = 0
		end
		--每N秒按下并释放4键
		if ((Times_Key_4*Barbarian_Macro_LoopInterval) == 390) then
			PressAndReleaseKey(0x42)--按下F8键
			Times_Key_4 = 0
		end
		--每N按下并释放鼠标右键
		if ((Times_Key_6*Barbarian_Macro_LoopInterval) >= 270) then
			PressAndReleaseMouseButton(3)
			Times_Key_6 = 0
		end

		if not IsKeyLockOn("numlock") then
			if ((Times_Key_5*Barbarian_Macro_LoopInterval) >= 100) then
				PressAndReleaseMouseButton(1)
				Times_Key_5 = 0
			end
		else
			if ((Times_Key_5*Barbarian_Macro_LoopInterval) >= 100) then
				PressAndReleaseKey(0x3D)--点击F3键强制移动
				Times_Key_5 = 0
			end
		end

		--按住SHIFT进行按键控制
--		if (IsModifierPressed("shift")) then --按住lshift键中断技能
--			ReleaseMouseButton(1)
--			ReleaseKey(0x3C)
--		else
--			if not (IsMouseButtonPressed(1)) then
--				ReleaseMouseButton(1)
--				PressKey(0x3C)
--				PressMouseButton(1)
--			else
--				if (IsModifierPressed("alt")) then --按住lalt键开门或吃祭坛
--					ReleaseKey(0x3C)
--				else
--					PressKey(0x3C)
--				end
--			end
--		end
    end
end
---------------------------------------------------------------------------------------------------------
--魂淡
function hd()
	if (IsKeyLockOn("scrolllock")) then
		--按下并释放按键
		--PressAndReleaseKey(0x42)--按下F8键
		PressAndReleaseKey(0x40)--按下F6键
		--点击鼠标右键
		PressAndReleaseMouseButton(3)
		Sleep(10)

		Times_Key_1 = 0
		Times_Key_2 = 0
		Times_Key_3 = 0
		Times_Key_4 = 0
		Times_Key_6 = 0
	end

	--如果scrolllock键已按下启动循环，否则退出循环--如果scrolllock键已按下并且numlock已按下则启动循环，否则退出循环
	while (IsKeyLockOn("scrolllock")) do
		Sleep(Barbarian_Macro_LoopInterval) --循环间隔
		--PressAndReleaseMouseButton(1)
		--PressAndReleaseKey(0x3D)

		Times_Key_1 = Times_Key_1 + 1
		Times_Key_2 = Times_Key_2 + 1
		Times_Key_3 = Times_Key_3 + 1
		Times_Key_4 = Times_Key_4 + 1
		Times_Key_6 = Times_Key_6 + 1

		--每1秒按下并释放1键
		if ((Times_Key_1*Barbarian_Macro_LoopInterval) == 300) then
			PressAndReleaseKey(0x3F)--按下F5键
			Times_Key_1 = 0
		end
		--每N秒按下并释放2键
		if ((Times_Key_2*Barbarian_Macro_LoopInterval) == 330) then
			PressAndReleaseKey(0x40)--按下F6键
			Times_Key_2 = 0
		end
		--每N秒按下并释放3键
		if ((Times_Key_3*Barbarian_Macro_LoopInterval) == 360) then
			PressAndReleaseKey(0x41)--按下F7键
			Times_Key_3 = 0
		end
		--每N秒按下并释放4键
		if ((Times_Key_4*Barbarian_Macro_LoopInterval) == 390) then
			PressAndReleaseKey(0x42)--按下F8键
			Times_Key_4 = 0
		end
		--每N按下并释放鼠标右键
		if (IsModifierPressed("shift")) then
			if ((Times_Key_6*Barbarian_Macro_LoopInterval) >= 500) then
				PressAndReleaseMouseButton(3)
				Times_Key_6 = 0
			end
		else
			PressAndReleaseMouseButton(1)
		end

		--按住SHIFT进行按键控制
--		if (IsModifierPressed("shift")) then --按住lshift键中断技能
--			ReleaseMouseButton(1)
--			ReleaseKey(0x3C)
--		else
--			if not (IsMouseButtonPressed(1)) then
--				ReleaseMouseButton(1)
--				PressKey(0x3C)
--				PressMouseButton(1)
--			else
--				if (IsModifierPressed("alt")) then --按住lalt键开门或吃祭坛
--					ReleaseKey(0x3C)
--				else
--					PressKey(0x3C)
--				end
--			end
--		end
    end
end
---------------------------------------------------------------------------------------------------------